package com.baidu.shop.mapper;

import com.baidu.shop.entity.BrandEntity;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


/**
 * @Description:
 * @ClassName: BrandMapper
 * @Author: User
 * @date: 2020.08.31 14:47
 * @version: 1.0
 */
public interface BrandMapper extends Mapper<BrandEntity> , SelectByIdListMapper<BrandEntity,Integer> {



    @Select("SELECT b.* FROM `tb_brand` b , tb_category_brand cb where cb.brand_id=b.id and cb.category_id = #{id}")
    List<BrandEntity> selectByCBId(Integer id);

    @Select("select * FROM  tb_brand WHERE id in(select brand_id FROM  tb_category_brand where category_id = #{cid})")
    List<BrandEntity> getBrandByCategory(Integer cid);
}
